Release 10.1A: OpenEdge Development:
ProDataSets


Using the SAVE-WHERE-STRING attribute

As outlined in the previous section, the first step in saving a change is to locate the database buffer the temp-table row was derived from. Progress can always determine how to identify that row, based on the KEYS phrase of the Data-Source or the primary key of the database table, but it is not always trivial for you to determine the same information in your procedures. For this reason, there is a SAVE-WHERE-STRING attribute on the Data-Source to return to you the where-clause you would need to use to retrieve the same record yourself, as shown:

data-source-handle:SAVE-WHERE-STRING( [ buffer-index | buffer-name ] ). 

As with SAVE-ROW-CHANGES, SAVE-WHERE-STRING defaults to the first (or only) buffer in the Data-Source. The attribute value is set internally by Progress to be the where-clause phrase (including the initial keyword WHERE) needed to find the database buffer identified by the buffer-index or buffer-name within the Data-Source. This can be useful when you need to build up custom code to retrieve database records of changed buffers, if using the SAVE-ROW-CHANGES method is not adequate. If you specify a buffer-index, it is the sequential position of the buffer within the list of multiple buffers for the Data-Source. If you specify the buffer-name, it must be the name of an after-table buffer in the list of buffers attached to the Data-Source. The buffer must be one that has a before-table, either static or dynamic. The attribute value qualifies field names in the buffer’s temp-table with the before-table name, not the after-table name. This is because this string can be used to find database records based on field values in the before-table rows, as your code is cycling through the before-table, processing each change.

If an error occurs during the database update, the ERROR attribute is set to true for the ProDataSet, the temp-table where the error occurred, and the buffer where the error occurred.

Table 6–2 summarizes all these change methods and the handles they can be used on.

Table 6–2: Change methods
Method name
ProDataSet handle
Temp-table buffer handle
ROW version
GET-CHANGES
Yes
Yes
None
SAVE-ROW-CHANGES
No
No
Only
MERGE-CHANGES
Yes
Yes
MERGE-ROW-CHANGES
ACCEPT-CHANGES
Yes
Yes
ACCEPT-ROW-CHANGES
REJECT-CHANGES
Yes
Yes
REJECT-ROW-CHANGES

In summary:


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095